﻿using UnityEngine;

namespace NL.RPG
{

    //(0:伤害; 1:暴击伤害; 2:治疗;   3:闪避    ;4:秒杀;  5:免疫)")
    public enum HudType:byte
    {
        hurt = 0,
        hurtex = 1,
        heal = 2,
        shanbi = 3,
        miaosha = 4,
        mianyi = 5,
    }


    public class Hud : MonoBehaviour
    {




        //对外接口..添加一个hud得显式.
        public static void AddHud(Vector3 pos, int hp, HudType type= HudType.hurt)
        {
            //if(_INSTANCE!=null)
            //    pos= _INSTANCE.transform.InverseTransformPoint(pos);


            _INSTANCE.AddOne(pos,hp, type);

            //测试效率使用..额外添加更多 
            for (int i = 0; i < _INSTANCE.MultipleSampleMore; i++)
            {
                _INSTANCE.AddOne(pos, hp, type);

            }
        }
        protected void AddOne(Vector3 pos, int hp, HudType type = HudType.hurt)
        {
            switch(type)
            {
                case HudType.hurt:
                case HudType.heal:
                    Spurter?.AddOne(pos, hp, type);
                    break;
                case HudType.hurtex:
                    Spurter_Baoji?.AddOne(pos, hp, type);
                    break;
                case HudType.mianyi:
                case HudType.shanbi:
                case HudType.miaosha:
                    Spurter_Teshu?.AddOne(pos, hp, type);
                    break;

            }
        }




 
        public int MultipleSampleMore = 0;





        static Hud _INSTANCE;

        [Header("发射机:普通;暴击;特殊")]
        [SerializeField] VFXSpurter Spurter;
        [SerializeField] VFXSpurter Spurter_Baoji;
        [SerializeField] VFXSpurter Spurter_Teshu;

        private void Awake()
        {
            _INSTANCE = this;
        }



    }
}